package com.study.example.gameserver.base;

import com.sparrow.common.util.PropertiesUtil;
import org.springframework.stereotype.Component;

import java.util.Properties;

@Component
public class ConfigService {

    private int serverId = PropertiesUtil.autoReloadInt("server.id", (val) -> setServerId(val), 0);

    private String appKey = PropertiesUtil.autoReloadString("app.key", (val) -> setAppKey(val), "");

    public void setServerId(int serverId) {
        this.serverId = serverId;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public int getServerId() {
        return serverId;
    }

    public  String getAppKey() {
        return appKey;
    }

}
